import request from "@/utils/request";

/**
 * 为角色分配资源权限
 * @param {Object} data - 分配数据
 * @param {number} data.roleId - 角色ID
 * @param {Array<string>} data.resourceCodes - 资源编码数组
 * @returns {Promise}
 */
export const assignRoleResources = (data) => {
  return request({
    url: "/api/system/ae/role-resources/assign",
    method: "post",
    data,
  });
};

/**
 * 获取角色的所有资源权限编码
 * @param {number} roleId - 角色ID
 * @returns {Promise}
 */
export const getRoleResourceCodes = (roleId) => {
  return request({
    url: `/api/system/ae/roles/${roleId}/resources`,
    method: "get",
  });
};


/**
 * 复制角色权限
 * @param {Object} data - 复制数据
 * @param {number} data.sourceRoleId - 源角色ID
 * @param {number} data.targetRoleId - 目标角色ID
 * @returns {Promise}
 */
export const getEmployeeResource = () => {
  return request({
    url: "/api/system/ae/employee/resources",
    method: "get"
  });
};